<?php
/**
 * TomatoCMS
 *
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@tomatocms.com so we can send you a copy immediately.
 *
 * @copyright    Copyright (c) 2009-2010 TIG Corporation (http://www.tig.vn)
 * @license        http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @version     $Id: product.php 2793 2010-05-03 18:48:14Z quanvo $
 * @since        2.0.5
 */

interface Shop_Models_Interface_Product
{
    /**
    * Add new product
    *
    * @param $product Shop_Models_Product
    * @return int
    */
    public function add($product);

    /**
     * Get all product by enterprise
     * $enterprise_id Id of enterprise
     * @return Tomato_Model_RecordSet
     **/
    public function findAllProducts($enterprise_id = null);

    public function getProductContentById($id);

    /**
    * Search for articles by collection of conditions
    *
    * @param int $offset
    * @param int $count
    * @param array $exp Searching conditions. An array contain various conditions, keys including:
    * - article_id
    * - category_id
    * - created_user_id
    * - status
    * - keyword
    * @return Tomato_Core_Model_RecordSet
    */
    public function find($offset, $count, $exp = null);

    /**
    * Count the number of articles by collection of conditions
    *
    * @param array $exp Searching conditions (@see find)
    * @return int
    */
    public function count($exp = null);

    /**
    * Get category by given Id
    *
    * @param int $id Id of product
    * @param varchar $language_code
    * @return Tomato_Modules_Shop_Models_Product
    */
    public function getProductById($id, $language_code=null);

    /**
    * Edit new product
    *
    * @param Tomato_Modules_Shop_Models_Product $product
    * @param int $product_id Id of product
    * @return void
    */
    public function edit($product, $product_id);

    /**
    * Get attribute by category id
    *
    * @param int $category_id Id of product
    * @return Tomato_Core_Model_RecordSet
    */
    public function getAttributeByCategoryId($category_id);

    /**
    * Get attribute type content
    *
    * @param int $attribute_id
    * @param varchar(255) $language_code
    * @return Tomato_Core_Model_RecordSet
    */
    public function getAttributeContentByAttributeIdLanguage($attribute_id, $language_code);

    /**
    * Get attribute type content
    *
    * @param int $attribute_id
    * @return Tomato_Core_Model_RecordSet
    */
    public function getAttributeContentByAttributeId($attribute_id);

    /**
    * Get all currency
    *
    * @return Tomato_Core_Model_RecordSet
    */
    public function getCurrency();

    /**
    * Delete product
    *
    * @param int $product_id
    * @return void
    */
    public function delete($product_id);

    /**
    * Edit new product
    *
    * @param Tomato_Modules_Shop_Models_Product $product
    * @param int $product_id Id of product
    * @return void
    */
    public function updateProductionDuration($product, $product_id);


    /*========================Front end function================================*/

    /**
     * Get product by any id follow language
     * @param: array $exp Is a array including ids
     * @param int $offset
     * @param int $count
     * @return Tomato_Model_Recordset
    **/
    public function getPById($exp = null, $offset = null, $count = null);

    /**
     * Check file exist in directory
     * Return new file
     * @param: $path Path file to directory
     * example: $path = 'C:\wamp\www\hoalan\upload\page\admin\2010\11\4ce0f0a438085_large.jpg'
     * @param: $file Path file formt server
     * example: $file = 'http://localhost/hoalan/upload/page/admin/2010/11/4ce0f0a438085_large.jpg'
     * @param: $name New file name
     * $name = 'square' is FROm 4ce0f0a438085_large.jpg TO 4ce0f0a438085_square.jpg
     * @return string
    **/
    public function checkFile($path, $file, $name = 'square');

    /**
     * Get category of enterprise
     * @param int $id Id of enterprise
     * @return Tomato_Model_Recordset
    **/
    public function catOfEnt($id = null);

    /**
     * Get product market data
     * @param int $id Id of product
     * @return Tomato_Models_Recordset
    **/
    public function getMarketData($id);

    /**
     * Add product market data
     * @param Shop_Models_Product $product
     * @return void;
    **/
    public function addMarketData($product);

    /**
     * Update product market data
     * @param Shop_Models_Product $product
     * @return void;
    **/
    public function updateMarketData($product);

    /**
     * Get product most viewed
     * @param int $count Number item geted
     * @return Tomato_Models_Recordset
    **/
    public function getMostViewed($count, $id = null);

    /**
     * Get product most buy
     * @param int $count Number item geted
     * @return Tomato_Models_Recordset
    **/
    public function getMostBuy($count, $id = null);

    /**
     * Get product advertise
     * @param int $count Number item geted
     * @return Tomato_Models_Recordset
    **/
    public function getAdvertise($count, $id = null);

    /**
    * Search for product by collection of conditions
    *
    * @param int $offset
    * @param int $count
    * @param array $exp Searching conditions. An array contain various conditions, keys including:
    * - article_id
    * - category_id
    * - created_user_id
    * - status
    * - keyword
    * @return Tomato_Core_Model_RecordSet
    */
    public function search($offset, $count, $exp = null, $related = false);

    /**
    * Count the number of articles by collection of conditions
    *
    * @param array $exp Searching conditions (@see find)
    * @return int
    */
    public function searchcount($exp = null, $related = false);

    /**
    * Search advanced for product by collection of conditions
    *
    * @param int $offset
    * @param int $count
    * @param array $exp Searching conditions. An array contain various conditions, keys including:
    * - article_id
    * - category_id
    * - created_user_id
    * - status
    * - keyword
    * @return Tomato_Core_Model_RecordSet
    */
    public function advanced($offset, $count, $exp = null, $related = false);

    /**
    * Count the number of articles by collection of conditions
    *
    * @param array $exp Searching conditions (@see find)
    * @return int
    */
    public function advancedcount($exp = null, $related = false);

    /**
    * Search for articles by collection of conditions
    *
    * @param int $offset
    * @param int $count
    * @param array $exp Searching conditions. An array contain various conditions, keys including:
    * - article_id
    * - category_id
    * - created_user_id
    * - status
    * - keyword
    * @return Tomato_Core_Model_RecordSet
    */
    public function frontFind($offset, $count, $exp = null);

    /**
    * Count the number of articles by collection of conditions
    *
    * @param array $exp Searching conditions (@see find)
    * @return int
    */
    public function frontCount($exp = null);
    
    
    /**
     * Update rate 
     *
     * @param array $data
     * @return void
     * @author khanhphan
     */
    public function updateRate($data);
}
